part of 'header.dart';

class HeaderMoreView extends StatelessWidget {
  HeaderMoreView({Key? key}) : super(key: key);
  final controller = Get.find<AppMoreController>();

  @override
  Widget build(BuildContext context) {
    var itemSize = 20.r;
    var showSize = itemSize * 0.6;
    return InkWell(
      onTap: controller.actionManage,
      child: Container(
        height: 50.r,
        color: ColorsUtil.white,
        padding: EdgeInsets.symmetric(horizontal: gap12),
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.center,
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Expanded(
              child: Text(
                '首页应用',
                style: pfSCStyle(color: ColorsUtil.title, fontSize: font14),
              ),
            ),
            Obx(
              () => Text(
                '已收起${controller.state.collectList.length}个应用',
                style:
                    pfMediumStyle(color: ColorsUtil.content, fontSize: font13),
              ),
            ),
            Obx(
              () => SizedBox(
                width: controller.state.collectList.length * showSize +
                    itemSize -
                    showSize,
                height: itemSize,
                child: Stack(
                  children: controller.state.collectList.reversed
                      .toList()
                      .asMap()
                      .map(
                        (key, value) => MapEntry(
                            key,
                            Positioned(
                              right: showSize * key,
                              width: itemSize,
                              height: itemSize,
                              child: loadImage(
                                  url: value.icon, fit: BoxFit.contain),
                            )),
                      )
                      .values
                      .toList(),
                ),
              ),
            ),
            Icon(
              IconUtil.arrow_right,
              size: 13.r,
              color: ColorsUtil.content,
            )
          ],
        ),
      ),
    );
  }
}
